import { createRouter, createWebHistory } from 'vue-router'
import userManage from './modules/userManage'
import roleList from './modules/roleList'
import permissionList from './modules/permissionList'
import articleRanking from './modules/articleRanking'
import articleCreate from './modules/articleCreate'

export const privateRoute = [
  userManage,
  roleList,
  permissionList,
  articleRanking,
  articleCreate
]

export const publicRoute = [
  {
    path: '/login',
    component: () => import('@/views/login')
  },
  {
    path: '/',
    redirect: '/profile',
    component: () => import('@/layout'),
    children: [
      // 个人中心
      {
        path: '/profile',
        component: () => import('@/views/profile'),
        meta: {
          title: '个人中心',
          icon: 'el-icon-user'
        }
      },
      // 404
      {
        path: '/404',
        component: () => import('@/views/error-page/404')
      },
      // 401
      {
        path: '/401',
        component: () => import('@/views/error-page/401')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes: publicRoute
})

export default router
